package com.wink.admin.utils;

import com.baomidou.mybatisplus.core.toolkit.Sequence;


/**
 * 雪花id生成
 * 可参考另一种：https://github.com/automvc/bee/blob/master/src/main/java/org/teasoft/bee/distribution/GenId.java
 * 实际实现：org.teasoft.honey.distribution.SerialUniqueId
 *
 * @author wink
 * @date 2020/11/16 11:31:44
 */
public class IdUtils {

    private IdUtils() {
    }

    private final static Sequence SEQUENCE = new Sequence();

    /**
     * 获取ID，线程安全
     */
    public static Long getId() {
        // IdentifierGenerator identifierGenerator = GlobalConfigUtils.getGlobalConfig(this.configuration).getIdentifierGenerator();

        return SEQUENCE.nextId();
    }

}